<?php
$date = date('d-m-Y');

$send_info = array(
	'sendby'		=> $tennguoigui,
	'sendemail'		=> $emailnguoigui
	);

## gui mail user	
$config_info = array(
	'url'			=> get_bloginfo('home'),
	'name'			=> get_bloginfo('name'),
	'link'			=> get_bloginfo('home'),
	'date'			=> $date,
	'subject'		=> 'Tham khao Bat Dong San',
	'contact_name'  => '',
	'contact_email' => $emailnguoigui,  // gui mail cho toi
	'usermessage'	=> 'Tham khảo bản tin bất động sản',
	'html_link' 	=> 'xtemplate-email-gui-mail-ban-be.html'	
);

function 	gui_noi_dung_travel($config_info,$send_info,$message,$contact_email)
{
                include_once	'xtemplate.class.php';
                $header   		= 'Content-type: text/html; charset=utf-8\r\n';	                               
                $parseTemplate	=	new XTemplate($config_info['html_link']);
                
                $usermessage  	= $config_info['usermessage'];
                $subject		= $config_info['subject'];               
                
                $parseTemplate->assign('subject',$subject);
                $parseTemplate->assign('link', $config_info['link']);
                $parseTemplate->assign('name',$config_info['name']);                
                $parseTemplate->assign('date',$config_info['date']);
                $parseTemplate->assign('usermessage',$usermessage);  
                $parseTemplate->assign('contactname',$contact_email);              
                              
                $parseTemplate->assign('company_content', $message);
                
                ## gui sendby
                $parseTemplate->assign('sendby', $send_info['sendby']);                
                $parseTemplate->assign('sendemail', $send_info['sendemail']);
                	
                ## gui mail
                $parseTemplate->parse('main');                	
               	if(wp_mail($contact_email, $subject, $parseTemplate->text('main'), $header))
               		return true;
               	return false;
                	
}

	
## gui mail khach hang
//$result = gui_noi_dung_travel($config_info,$send_info,$message,$contact_email);
## gui mail admin
//$result2 = gui_noi_dung_travel($config_info,$send_info,$message,$contact_email);
